<?php
/**
 * Created by PhpStorm.
 * User: YWX
 * Date: 2017/4/19
 * Time: 20:57
 */

$userData=require __DIR__.'/data/user.php';

if(isset($_SESSION['user'])){
    echo '你已经登录';
}else{
    $username = $_POST['username'];
    $password = $_POST['password'];
    if($username == $userData['username'] && $password == $userData['password']){
        $_SESSION['user']=[
          'username'=>$username,
        ];
        echo '登录成功';
    }else{
        echo '用户名或密码错误！！！！';
    }

}


